package com.chenjun.core.dao.generator.mapper;

import com.chenjun.common.model.DataGridModel;
import com.chenjun.core.dao.generator.entity.OaBillAttnDetail;
import com.chenjun.core.dao.generator.entity.OaBillAttnDetailExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 
 * @Description: 考勤明细dao
 * @author dongyibin
 * @date 2017-8-16 下午8:04:42
 */
public interface OaBillAttnDetailMapper {
    @Delete({
        "delete from oa_bill_attn_detail",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into oa_bill_attn_detail (id, no, ",
        "status, bill_date, ",
        "note, empl_id, empl_code, ",
        "empl_name, man_hours_type_id, ",
        "man_hours_type_name, clock_time, ",
        "clock_place, attn_type_id, ",
        "attn_type_name, clock_ip)",
        "values (#{id,jdbcType=INTEGER}, #{no,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{billDate,jdbcType=TIMESTAMP}, ",
        "#{note,jdbcType=VARCHAR}, #{emplId,jdbcType=VARCHAR}, #{emplCode,jdbcType=VARCHAR}, ",
        "#{emplName,jdbcType=VARCHAR}, #{manHoursTypeId,jdbcType=INTEGER}, ",
        "#{manHoursTypeName,jdbcType=VARCHAR}, #{clockTime,jdbcType=TIMESTAMP}, ",
        "#{clockPlace,jdbcType=VARCHAR}, #{attnTypeId,jdbcType=INTEGER}, ",
        "#{attnTypeName,jdbcType=VARCHAR}, #{clockIp,jdbcType=VARCHAR})"
    })
    int insert(OaBillAttnDetail record);

    int insertSelective(OaBillAttnDetail record);

    List<OaBillAttnDetail> selectByExample(OaBillAttnDetailExample example);

    @Select({
        "select",
        "id, no, status, bill_date, note, empl_id, empl_code, empl_name, man_hours_type_id, ",
        "man_hours_type_name, clock_time, clock_place, attn_type_id, attn_type_name, ",
        "clock_ip",
        "from oa_bill_attn_detail",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    OaBillAttnDetail selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(OaBillAttnDetail record);

    @Update({
        "update oa_bill_attn_detail",
        "set no = #{no,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "bill_date = #{billDate,jdbcType=TIMESTAMP},",
          "note = #{note,jdbcType=VARCHAR},",
          "empl_id = #{emplId,jdbcType=VARCHAR},",
          "empl_code = #{emplCode,jdbcType=VARCHAR},",
          "empl_name = #{emplName,jdbcType=VARCHAR},",
          "man_hours_type_id = #{manHoursTypeId,jdbcType=INTEGER},",
          "man_hours_type_name = #{manHoursTypeName,jdbcType=VARCHAR},",
          "clock_time = #{clockTime,jdbcType=TIMESTAMP},",
          "clock_place = #{clockPlace,jdbcType=VARCHAR},",
          "attn_type_id = #{attnTypeId,jdbcType=INTEGER},",
          "attn_type_name = #{attnTypeName,jdbcType=VARCHAR},",
          "clock_ip = #{clockIp,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(OaBillAttnDetail record);

	List<OaBillAttnDetail> doListByCondition(DataGridModel param);

	/**
	 * @Description: 根据员工ID及其他条件取不重复数据 
	 * @param param
	 * @return
	 * @author dongyibin
	 * @date 2017-8-22 下午10:13:48
	 */
	List<OaBillAttnDetail> getDistinctByEmplid(DataGridModel param);
}